from .models import User
from schools.models import School


def front_user(request):
    user_phone = request.session.get("user_phone")
    context = {}
    if user_phone:
        user = User.objects.filter(css_phone=user_phone).first()
        school = School.objects.filter(css_phone=user_phone).first()
        if user:
            context['front_user'] = user
        elif school:
            context['front_user'] = school

    return context
